package cn.dai.test.da.queue;

import org.junit.Test;

/**
 * @author ArkD42
 * @file Jdbc01
 * @create 2020 - 06 - 07 - 16:58
 */
public class QueueTest {

    @Test
    public void arrayQueueTest(){
        ArrayQueueDemo queueDemo = new ArrayQueueDemo(5);

        for (int i = 0; i < 10; i++) {
            if (queueDemo.isFull()){
                int element = queueDemo.getElement();
                System.out.println("取出了元素 ：" + element);
            }
            queueDemo.addQueue( (i + 1) * 10);
            queueDemo.showSequence();
            System.out.println("- - - -");

        }
    }

    @Test
    public void circleQueueTest(){
        CircleQueueDemo queueDemo = new CircleQueueDemo(5);

        for (int i = 0; i < 10; i++) {
            if (queueDemo.isFull()){
                int element = queueDemo.getElement();
                System.out.println("取出了元素 ：" + element);
            }
            queueDemo.addQueue( (i + 1) * 10);
            queueDemo.showSequence();
            System.out.println("- - - -");

        }


    }
}
